package com.thingsgrid.system.wrapper;

import com.thingsgrid.system.entity.DataScope;
import com.thingsgrid.system.vo.DataScopeVO;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import com.thingsgrid.system.cache.DictCache;


/**
 * 包装类,返回视图层所需的字段
 *
 * @author Chill
 */
public class DataScopeWrapper extends BaseEntityWrapper<DataScope, DataScopeVO> {

	public static DataScopeWrapper build() {
		return new DataScopeWrapper();
	}

	@Override
	public DataScopeVO entityVO(DataScope dataScope) {
		DataScopeVO dataScopeVO = BeanUtil.copy(dataScope, DataScopeVO.class);
		assert dataScopeVO != null;
		String scopeTypeName = DictCache.getValue("data_scope_type", dataScope.getScopeType());
		dataScopeVO.setScopeTypeName(scopeTypeName);
		return dataScopeVO;
	}

}
